#!/usr/bin/env python3
"""
验证用户密码
"""

from models import SessionLocal, User

def verify_passwords():
    """尝试验证常见的测试密码"""
    db = SessionLocal()
    try:
        users = db.query(User).filter(User.username.isnot(None)).all()
        
        # 常见的测试密码
        test_passwords = ['123456', 'password', 'admin123', 'test123']
        
        print("\n" + "="*60)
        print("用户密码验证")
        print("="*60)
        
        for user in users:
            print(f"\n用户名: {user.username}")
            print(f"昵称: {user.nickname}")
            
            # 尝试常见的测试密码
            matched = False
            for pwd in test_passwords:
                if user.check_password(pwd):
                    print(f"✅ 密码: {pwd}")
                    matched = True
                    break
            
            if not matched:
                print("❌ 未找到匹配的常见测试密码")
                print("   提示: 密码可能是其他值")
            
            print("-" * 60)
        
        print("\n💡 建议:")
        print("  如果无法登录，可以:")
        print("  1. 使用手机号+验证码登录")
        print("  2. 重新注册新账号")
        print("  3. 或者重置密码（需要开发相关功能）")
        print("="*60)
        
    finally:
        db.close()

if __name__ == "__main__":
    verify_passwords()

